package com.example.zhu.mapper;

import com.example.zhu.entity.Fake;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface FakeMapper {


    @Insert("insert into fake(id, order_status,order_id,count_id) values (#{id},#{orderStatus},#{orderId},#{countId})")
    @Options(useGeneratedKeys=true, keyProperty="fakeId", keyColumn="fake_id")
    void insert(Fake fake);

    @Select("SELECT * FROM fake WHERE id = #{id1}")
    Fake selectById(long id1);

    @Select("select * from fake where fake_id = #{fakeId}")
    Fake selectByFakeId(Integer fakeId);

    @Update("update fake set order_status = 3 where count_id = #{id}")
    void update(Integer id);

    @Select("select * from fake where order_id = #{id}")
    List<Fake> selectByOrderId(Long id);

    @Update("update fake set state = 1 where fake_id = #{id}")
    void updateState(Integer id);

    @Update("update fake set order_status = #{status} where count_id = #{id}")
    void updateStateByCountId(Integer id,Integer status);

    @Select("select * from fake where count_id = #{id}")
    Fake selectByCountId(Integer id);

    @Delete("delete from fake where order_id = #{id}")
    void deleteByOrderId(Integer id);
}
